<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Services extends MY_Controller {
	function __construct(){
		parent::__construct();
		$this->load->model('page_model');
		$this->load->model('article_model');
		$this->load->model('gallery_model');
		$this->load->model('coltypes_model');
	}
	//客户服务	
	public function index(){
		$data['seo']=$this->db->get_where('columns',array('id'=>9))->row_array();//获取seo
		$this->load->view('service',$data);
	}
	
	//常见问题
	public function faq($page=1){
		/*分页*/
		$config['base_url'] = SITE_URL.'services/faq/';//分页地址
		$config['uri_segment'] = 3;//页码所在URI段
		//计算当前页面新闻总条数
		$where=array('cid'=>10,'audit'=>1);
		$config['total_rows'] = $this->db->where($where)->from('gallery')->count_all_results();
		$config['per_page'] = 6;//每页显示的条数
		$config['use_page_numbers'] = TRUE;//默认分页URL中是显示每页记录数,启用use_page_numbers后显示的是当前页码。
		$data['fenye']=$this->article_model->gal_page($config,$page,$where);
		$data['seo']=$this->db->get_where('columns',array('id'=>10))->row_array();//获取seo
		$this->load->view('faq',$data);
	}
	
	public function faq_ajax(){
		$page=$_GET['page'];
		header('Content-type:application/json');
		/*分页*/
		$config['base_url'] = SITE_URL.'services/faq/';//分页地址
		$config['uri_segment'] = 3;//页码所在URI段
		//计算当前页面新闻总条数
		$where=array('cid'=>10,'audit'=>1);
		$config['total_rows'] = $this->db->where($where)->from('gallery')->count_all_results();
		$config['per_page'] = 6;//每页显示的条数
		//判断是否有下一页
		if($config['total_rows']>$page*$config['per_page']){
			$back['status']= 'yes';
		}else{
			$back['status']= 'no';
		}
		$config['use_page_numbers'] = TRUE ;//默认分页URL中是显示每页记录数,启用use_page_numbers后显示的是当前页码。
		$data['fenye']=$this->article_model->gal_page($config,$page,$where);
		$html= "";
		foreach ($data['fenye']['new_con'] as $k =>$v){
			$photo=UPLOAD_URL.tag_photo($v['photo']);
			$html.= '<div class="w1190 faq-frame">
								<div class="faq-title">Q：'.$v['title'].'</div>
								<div class="faq-wrap">
									<div class="fl faq-text">
										'.$v['answer'].'
									</div>
									<div class="fr faq-more"></div>
									<div class="fr faq-less"></div>
								</div>
							</div>' ;
		}
		$back['list']=$html;
		exit(json_encode($back));
	}
	
	
	//产品维修
	public function repair(){
		$data['seo']=$this->db->get_where('columns',array('id'=>11))->row_array();//获取seo
		$this->load->view('product-repair',$data);
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}